package com.weixing.mall.provider.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weixing.mall.provider.model.domain.Order;
import com.weixing.mall.provider.model.query.*;
import com.weixing.mall.provider.model.vo.OrderShowVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 领导看板
 * </p>
 *
 * @author 0202
 * @date 2020-5-30
 */
public interface LeaderShowMapper extends BaseMapper<Order> {
    /**
     * 101 领导看板主页
     * 102 库存看板
     * 103 财务报表看板
     * 104发货看板
     * 105客服看板
     * 106代理商看板
     * 107会员看板
     * 108商品看板
     * 109销售看板
     * 110广告看板
     */
    /**领导看板sql start**/
    //common-sql  start
    //订单销售总数量 使用 101、103
    Long orderSaleTotalForLeader(@Param("orderStatus") Integer orderStatus,@Param("orderType") Integer orderType,@Param("startTime") String startTime,@Param("endTime") String endTime);
    //代理商总数 使用 101、105
    Long agentTotal(@Param("customerId")Long customerId,@Param("isBind")Integer isBind,@Param("isEnable")Integer isEnable,@Param("startTime") String startTime,@Param("endTime") String endTime);
    //end

    //101-start
    Long orderTotalForLeader(@Param("startTime") String startTime,@Param("endTime") String endTime);

    BigDecimal saleAmountTotalForLeader(@Param("orderStatus") Integer orderStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long shippedTotalForLeader(@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long customerTotalForLeader(@Param("orderStatus") Integer orderStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long stockTotalForLeader();

    List<Map<String,Object>> yearSaleTotalList(@Param("year1") String year1,@Param("year2") String year2);

    BigDecimal thisYear();

    BigDecimal lastYear();

    List<Map<String,Object>> monthSaleTotalList(@Param("month1") String month1,@Param("month2") String month2);

    BigDecimal thisMonth();

    BigDecimal lastMonth();

    List<Map<String,Object>> partitionSaleTotalList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    BigDecimal actSaleTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> actSaleTotalList(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("actType") Integer actType);

    Long goodsTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long memberTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long memberTotalOrderAddress(@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long adsTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);
    //101-end

    //102-start
    Long stockTotal(@Param("qs") LeaderStockQuery leaderStockQuery);

    IPage<Map<String,Object>> getStockList(@Param("pg")Page page,@Param("qs") LeaderStockQuery leaderStockQuery);
    //102-end

    //103-start
    BigDecimal saleAmountTotalForFinancial(@Param("orderStatus")Integer orderStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    BigDecimal saleCostTotalForFinancial(@Param("orderStatus")Integer orderStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> categorySaleTop5(@Param("orderStatus")Integer orderStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> goodsSaleTop5(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> provinceSaleTop10(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> citySaleTop10(@Param("startTime") String startTime,@Param("endTime") String endTime);

    IPage<Map<String,Object>> areaSaleList(@Param("pg")Page page,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("cityName") String cityName);
    //103-end

    //104start
    Long canceledOrderTotal(@Param("productStatus")Integer productStatus,@Param("nosuppllyAudit")Integer nosuppllyAudit,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long outStockOrderTotal(@Param("productStatus")Integer productStatus,@Param("nosuppllyAudit")Integer nosuppllyAudit,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long waitOrderTotal(@Param("productStatus")Integer productStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long waitConfirmedOrderTotal(@Param("productStatus")Integer productStatus,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long refundedOrderTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long shippedOrderTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> shippedChartTotalList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> outStockChartTotalList(@Param("productStatus")Integer productStatus,@Param("nosuppllyAudit")Integer nosuppllyAudit,@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> refundedChartTotalList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> canceledChartTotalList(@Param("productStatus")Integer productStatus,@Param("nosuppllyAudit")Integer nosuppllyAudit,@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> shipperPartitionChartTotalList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    IPage<Map<String,Object>> shipperTotalList(@Param("pg")Page page,@Param("startTime") String startTime,@Param("endTime") String endTime);

    //104end

    //105start
    Long auditOrderTotal(@Param("orderStatus")Integer orderStatus,@Param("customerId")Long customerId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long placeOrderTotal(@Param("customerId")Long customerId,@Param("orderFrom")Integer orderFrom,@Param("startTime") String startTime,@Param("endTime") String endTime);

    Long agentRenewTotal(@Param("customerId")Long customerId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> kefuSaleAmountTotal(@Param("startTime") String startTime,@Param("endTime") String endTime);
    //105end

    //106start

    //代理商总数、团队总数、金级代理商数、银级代理商数、金级一级代理商数、银级一级代理商数（通过条件查询不同的结果）
    Long agentSyntheticalReport(@Param("findTeam")String findTeam,@Param("level") Integer level,@Param("type") Integer type);

    List<Map<String,Object>> agentLevelDistribution();

    List<Map<String,Object>> getAgentSaleList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> getTeamSaleList(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<Map<String,Object>> getAgentAreaList();

    //106end

    //107start

    IPage<Map<String,Object>> getMemberReport(@Param("pg")Page page,@Param("qs") LeaderMemberQuery leaderMemberQuery);

    IPage<Map<String,Object>> getBuyReport(@Param("pg")Page page,@Param("qs") LeaderMemberQuery leaderMemberQuery);

    //107end

    //108start

    List<Map<String,Object>> getGoodsSaleListTop20(@Param("startTime") String startTime,@Param("endTime") String endTime);

    IPage<Map<String,Object>> getGoodsSaleList(@Param("pg")Page page,@Param("qs") LeaderGoodsQuery leaderGoodsQuery);

    //108end

    //109start

    Map<String,Object> saleNumberAndAmountReport(@Param("qs") LeaderSaleQuery leaderSaleQuery);

    IPage<Map<String,Object>> personalSaleReportList(@Param("pg")Page page,@Param("qs") LeaderSaleQuery leaderSaleQuery);

    IPage<Map<String,Object>> teamSaleReportList(@Param("pg")Page page,@Param("qs") LeaderSaleQuery leaderSaleQuery);

    Map<String,Object> getRecentActId();

    IPage<OrderShowVo> saleTeamOrderList(@Param("pg")Page initMpPage, @Param("qs")LeaderSaleOrderListQuery leaderSaleQuery);

    IPage<OrderShowVo> salePrsonOrderList(@Param("pg")Page initMpPage, @Param("qs")LeaderSaleOrderListQuery leaderSaleQuery);

    Map<String, Object> saleNumberAndAmountByActId( @Param("qs")LeaderSaleQuery lsq);
    List<Map<String,Object>> getStockSkuList( @Param("qs")LeaderStockQuery lsq);

    List<Map<String, Object>> actList(@Param("dateTime") Date dateTime,@Param("type") Integer type);

    IPage<Map<String, Object>> agentList(@Param("pg")Page page, @Param("qs") LeaderAgentQuery  leaderAgentQuery);

    IPage<Map<String, Object>> agentRenewList(@Param("pg")Page initMPage, @Param("qs")LeaderAgentReNewQuery agentQuery);

    IPage<Map<String, Object>> getBuyList(@Param("pg")Page initMpPage,  @Param("qs")LeaderMemberQuery leaderMemberQuery);

    List<Map<String, Object>> getSaleFxList();

    @Select("SELECT * from ads_media_label")
    List<Map<String, Object>> adsLabel();

    List<Map<String, Object>>  orderSaleListForLeader(@Param("pg")Page initMpPage,  @Param("qs")LeaderShowOrderQuery leaderShowOrderQuery );

    List<Map<String, Object>> getSaleSKuList(@Param("qs")LeaderGoodsQuery leaderGoodsQuery);


    //109end

    //110start
    //110end
    /**领导看板sql end**/
}
